﻿
using PSE.Framework.Communication.Configuration.Adapters;
using System.Configuration;
namespace PSE.Framework.Communication.Configuration.Adapters.File
{
    public abstract class FileInputAdapterConfiguration : StreamInputAdapterConfiguration
    {
        [ConfigurationProperty("fileNameFilter", IsRequired = false, DefaultValue = "*")]
        public string FileNameFilter
        {
            get { return !string.IsNullOrEmpty((string)base["fileNameFilter"]) ? (string)base["fileNameFilter"] : "*"; }
            set { base["fileNameFilter"] = value; }
        }

        [ConfigurationProperty("inputPath", IsRequired = false)]
        public string InputPath
        {
            get { return CommunicationConfigurationManager.GetFullPath((string)base["inputPath"]); }
            set { base["inputPath"] = value; }
        }

        [ConfigurationProperty("importingPath", IsRequired = false)]
        public string ImportingPath
        {
            get { return CommunicationConfigurationManager.GetFullPath((string)base["importingPath"]); }
            set { base["importingPath"] = value; }
        }

        [ConfigurationProperty("outputPath", IsRequired = false)]
        public string OutputPath
        {
            get { return CommunicationConfigurationManager.GetFullPath((string)base["outputPath"]); }
            set { base["outputPath"] = value; }
        }

        [ConfigurationProperty("errorPath", IsRequired = false)]
        public string ErrorPath
        {
            get { return CommunicationConfigurationManager.GetFullPath((string)base["errorPath"]); }
            set { base["errorPath"] = value; }
        }

        [ConfigurationProperty("cancelPath", IsRequired = false)]
        public string CancelPath
        {
            get { return CommunicationConfigurationManager.GetFullPath((string)base["cancelPath"]); }
            set { base["cancelPath"] = value; }
        }

        [ConfigurationProperty("ignoreFirstRows", IsRequired = false, DefaultValue = 0)]
        public int IgnoreFirstRows
        {
            get { return (int)base["ignoreFirstRows"]; }
            set { base["ignoreFirstRows"] = value; }
        }

        [ConfigurationProperty("ignoreLastRows", IsRequired = false, DefaultValue = 0)]
        public int IgnoreLastRows
        {
            get { return (int)base["ignoreLastRows"]; }
            set { base["ignoreLastRows"] = value; }
        }


        public string OriginalFileNameFilter
        {
            get { return (string)base["fileNameFilter"]; }
        }

        public string OriginalInputPath
        {
            get { return (string)base["inputPath"]; }
        }

        public string OriginalImportingPath
        {
            get { return (string)base["importingPath"]; }
        }

        public string OriginalOutputPath
        {
            get { return (string)base["outputPath"]; }
        }

        public string OriginalErrorPath
        {
            get { return (string)base["errorPath"]; }
        }

        public string OriginalCancelPath
        {
            get { return (string)base["cancelPath"]; }
        }

    }
}